package com.clj.ext;

import javax.swing.table.DefaultTableModel;
import java.util.Vector;

/**
 * Author: Harry Chen
 * Date: 2023/02/24 15:58
 * Description: 表格
 */
public class MainViewTableModel_clj extends DefaultTableModel {
    static Vector<String> columns = new Vector<>();

    static {
        columns.addElement("id");
        columns.addElement("姓名");
        columns.addElement("学号");
        columns.addElement("住址");
        columns.addElement("语文");
        columns.addElement("数学");
        columns.addElement("英语");
        columns.addElement("总分");
    }

    private MainViewTableModel_clj() {
        super(null, columns);
    }

    private static MainViewTableModel_clj mainViewTableModelClj = new MainViewTableModel_clj();

    public static MainViewTableModel_clj assembleModel(Vector<Vector<Object>> data) {
        mainViewTableModelClj.setDataVector(data, columns);
        return mainViewTableModelClj;
    }

    public static void updateModel(Vector<Vector<Object>> data) {
        mainViewTableModelClj.setDataVector(data, columns);
    }

    public static Vector<String> getColums() {
        return columns;
    }

    public boolean isCellEditable(int row, int column) {
        return false;
    }
}
